<template>
  <el-container>
    <el-header height="70px">
      <div class="headerFather">
        <div class="headerTops">
          <div class="logo">
            <span>漫画世界</span>
          </div>
          <ul>
            <li v-for="item in headerTopsList" :key="item.id">{{ item }}</li>
          </ul>
          <div class="operationButton">
            <div
              class="operationButtonDiv"
              v-for="item in headerTopsoperationButton"
              :key="item.id"
            >
              <div v-if="item.id == 1 || item.id == 4">
                <img :src="item.url" alt="" />
              </div>
              <div v-else-if="item.id == 2 || item.id == 3">
                <i :class="item.url"></i>
              </div>
              <p>{{ item.name }}</p>
            </div>
            <div class="user">
              <img src="../../assets/images/comic/header/headerUser.gif" />
            </div>
          </div>
        </div>
      </div>
    </el-header>
    <el-main><router-view /></el-main>
    <el-footer>Footer</el-footer>
  </el-container>
</template>

<script>

export default {
  data () {
    return {
      headerTopsList: ['首页', '更新', '排行', '火热'],
      headerTopsoperationButton: [
        { id: '1', name: 'VIP', fild: 'headerVip', url: require('../../assets/images/comic/header/header-vip.png') },
        { id: '2', name: '历史', fild: 'history', url: 'el-icon-time' },
        { id: '3', name: '收藏', fild: 'collection', url: 'el-icon-star-on' },
        { id: '4', name: '礼物', fild: 'gift', url: require('../../assets/images/comic/header/header-lb.png') }
      ]
    };
  },
  created: function () {
    var mainPath = window.sessionStorage.getItem('mainPath');
    if (mainPath === null || mainPath === '') {
      window.sessionStorage.setItem('mainPath', '/homePage');
      mainPath = '/homePage';
    }
    console.log(this.$router);
    this.$router.push(mainPath);
  }

};

</script>
<style lang="less" scoped>
.el-container {
  height: 100%;
  padding: 0px;
  margin: 0px;
  .el-header {
    padding: 0px;
    background-color: white;
    position: fixed;
    top: 0px;
    width: 100%;
    text-align: center;
  }
  .el-main {
    margin-top: 70px;
    background-color: yellow;
    margin: 0px;
    margin-top: 70px;
    padding: 0px;
    height: 100%;
  }
  .el-footer {
    background-color: green;
  }
}
.el-header .headerFather {
  height: 100%;
  width: 80%;
  margin: 0 auto;
}

.el-header .headerTops {
  height: 100%;
  width: 100%;
  float: left;
  //  display: link;
  background-color: white;
  color: blueviolet;
  > .logo {
    height: 100%;
    width: 10%;
    float: left;
    // display: link;
    display: flex;
    align-items: center;
    span {
      font-weight: bold;
      font-size: 25px;
      color: blueviolet;
      height: 100%;
      background-color: white;
      display: block;
      display: flex;
      align-items: center;
    }
  }
  > ul {
    float: left;
    width: 40%;
    height: 100%;
    display: flex;
    > li {
      display: inline;
      list-style: none;
      font-size: 20px;
      height: 100%;
      margin-left: 30px;
      display: flex;
      align-items: center;
    }
  }
  > .operationButton {
    display: flex;
    height: 100%;
    width: 50%;
    background-color: white;
    justify-content: flex-end;
    > .operationButtonDiv {
      width: 10%;
      height: 100%;

      > p {
        width: 100%;
        height: 50%;
        display: block;
      }
      > div {
        height: 50%;
        width: 100%;
        display: block;
        font-size: 20px;
        > img {
          position: relative;
          bottom: -10px;
          height: 20px;
          width: 20px;
        }
        > i {
          position: relative;
          bottom: -10px;
        }
      }
    }
    > .user {
      height: 100%;
      width: 15%;
      margin-left: 10px;
      > img {
        position: relative;
        bottom: -10px;
        height: 50px;
        width: 50px;
      }
    }
  }
}
</style>
